<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\admin\model\Diamond as DiamondModel;
use app\admin\model\Member as MemberModel;
/**
 * 示例接口
 */
class Mine extends Api
{
    // 无需登录的接口,*表示全部
    protected $noNeedLogin = ['index'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = [];

    public function index()
    {

        //我的
        $model = new MemberModel();
        $personal = $model
            ->where('status', 1)
            ->field('id,image,nickname')
            ->select();
        $personal = addWebSiteUrl($personal, ['image']);

        //我的订单
        $model = new DiamondModel();
        $order = $model
            ->where('type', 2)
            ->field('id,image,title')
            ->select();
        $order = addWebSiteUrl($order, ['image']);

        //大金刚区
        $model = new DiamondModel();
        $dia = $model
            ->where('type', 3)
            ->field('id,image,title')
            ->select();
        $dia = addWebSiteUrl($dia, ['image']);

        return sucessMsg(200, '获取成功！',
            [
                'personal' =>$personal,
                'order' => $order,
                'dia' => $dia,
            ]);
    }

}
